package com.chinasoft.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RedisTest {
    //注入模板对象
    @Autowired
    private RedisTemplate<String,String> redisTemplate;
    @RequestMapping("/redis")
    public void redisTest(){
        //存
        redisTemplate.opsForValue().set("get","zhangsan9999999999999999999");
        //取
        String value = redisTemplate.opsForValue().get("zhangsan1111112222");
        System.out.println(value);
    }
}
